package services

import (
	"go.uber.org/zap"
	"mon-go-web/internal/models"
	"mon-go-web/internal/repository"
	"mon-go-web/pkg/logger"
)

type UserService struct {
	userRepository *repository.UserRepository
}

func NewUserService() *UserService {
	return &UserService{userRepository: repository.NewUserRepository()}
}

func (us *UserService) Create(user *models.User) int64 {
	logger.Logger.Info("Creating user", zap.Any("user", user))
	rows := us.userRepository.Create(user)
	return rows
}

func (us *UserService) GetAll() []models.User {
	all := us.userRepository.GetAll()
	return all
}

func (us *UserService) Login() []models.User {
	all := us.userRepository.GetAll()
	return all
}
